package main.java.org.jmtp.sync;
import jmtp.*;

import joptsimple.OptionParser;
import joptsimple.OptionSet;

import java.util.logging.Level;
import java.util.logging.Logger;

public class Main {
	static Logger logger;

	public static void main(String[] argv) {
		String destination;

		/* Option parser : Start */
		OptionParser parser = new OptionParser();
		parser.accepts("destination").withRequiredArg();

		OptionSet options = parser.parse(argv);
		if (options.has("destination")) {
			destination = (String) options.valueOf("destination");
		}
		else {
			destination = "Music";
		}
		/* Option parser : End */
		/* Logger : Start */
		logger = Logger.getLogger("jmtp-sync");
		logger.setLevel(Level.ALL);
		/* Logger : End */

		/* Start JmtpSync */
		PortableDeviceManager manager = new PortableDeviceManager();
		try {
			JmtpSync sync = new JmtpSync(manager.getDevices()[0]);
			/* Scan device */
			sync.scanDevice(sync);
		}
		catch (ArrayIndexOutOfBoundsException e) {
			logger.log(Level.SEVERE,"Can't detect any device");
		}



	}
}
